package com.heima.admin.controller.v1;

import com.heima.admin.service.AdMediaReviewService;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/v1/news")
public class AdMediaReviewController {

    @Autowired
    private AdMediaReviewService adMediaReviewService;

    /**
     * 查询审核文章列表
     *
     * @param dto
     * @return
     */
    @PostMapping("/list_vo")
    public ResponseResult ArticleList(@RequestBody NewsAuthDto dto) {
        return adMediaReviewService.findArticleList(dto);
    }

    /**
     * 内容审核之点击获得内容详情
     *
     * @param id
     * @return
     */
    @GetMapping("/one_vo/{id}")
    public ResponseResult ArticleDetails(@PathVariable("id") Integer id) {
        return adMediaReviewService.findDetailById(id);
    }

    /**
     * 人工审核之拒绝
     * @param dto
     * @return
     */
    @PostMapping("/auth_fail")
    public ResponseResult AuthFail(@RequestBody NewsAuthDto dto) {
        return adMediaReviewService.authFail(dto);
    }

    /**
     * 人工审核之通过
     * @param dto
     * @return
     */
    @PostMapping("/auth_pass")
    public ResponseResult AuthPass(@RequestBody NewsAuthDto dto) {
        return adMediaReviewService.authPass(dto);
    }


}
